package org.veridiandynamics.server.model;

import org.veridiandynamics.server.dao.HibernateDriver;
import org.veridiandynamics.server.dao.Queryprocessor;
import org.veridiandynamics.server.domain.Roles;
import org.veridiandynamics.server.domain.User;

public class UserModel {
	private Queryprocessor processor = new Queryprocessor();
	private HibernateDriver driver = new HibernateDriver();
	
	public User login(String username, String password, Roles role){
		if (role == null) {
			return null;
		}
	 	Long id = Queryprocessor.UsernametoID(username);
	 	if (id == null) {
	 		return null;
	 	}
	 	
	 	return (User) driver.LoginRetrieve(username, password, role);
	}

}
